index = 1;
sum = 0;
ai= 1;
while (abs(ai) >= 1e-8)
    sum = sum + ai;
    index = index + 1;
    ai= ((-1)^(index-1)) / (2*index-1);
end
value_pi = 4*sum;
disp(value_pi);